package main

import "fmt"

func greeting(myChannel chan string) {
	myChannel <- "hello channel" // 发送数据到通道

}

func main() {
	// declare channel 1
	// var myChannel chan float64
	// myChannel = make(chan float64)

	// declare channel 2
	myChannel := make(chan string)
	go greeting(myChannel)
	// fmt.Println(<-myChannel) // 从通道接收数据

	// myChannel <- "hello"	// 报错，阻塞

	channelVar := <-myChannel
	fmt.Println(channelVar)

}
